package com.ihome.android.academy.db;

import android.content.ContentValues;

public class UpdateAppInfo {
	public static final String	KEY_STATUS				= "status";
	public static final String	KEY_FILE_PATH			= "filePath";
	public static final String	KEY_TIMESTAMP			= "timeStamp";
	public static final String	KEY_PKGNAME				= "pkgName";
	public static final String	KEY_NEEDUPDATE			= "needUpdate";
	public static final String	KEY_VERSION				= "version";
	public static final String	KEY_APPNAME				= "appName";
	public static final String	Key_APP_ID				= "appId";
	public static final String	KEY_ICONURL				= "iconUrl";
	public static final String	KEY_RATE				= "rate";
	public static final String	KEY_USERNUM				= "userNum";
	public static final String	KEY_APKFILESIZE			= "apkFileSize";
	public static final String	KEY_UPDATETIME			= "updateTime";
	public static final String	KEY_UPDATEVERSIONDES	= "updateVersionDes";
	public static final String	KEY_URL					= "url";
	public static final String	KEY_FILENAME			= "fileName";

	/** App 状态 */
	public int					status;
	/** 文件下载路径 */
	public String				filePath;
	/** 文件最后修改时间 */
	public long					timeStamp;
	/** 应用包名 */
	public String				pkgName;
	/** 是否需要升级：true/false 不需要升级：可能是由于应用已经下载/版本已经是最新 */
	public boolean				isUpdate;
	/** 当前版本号 */
	public String				version;
	/** 应用名称 */
	public String				appName;
	/** 应用ID */
	public int					appId;
	/** 应用图标 */
	public String				iconUrl;
	/** 评分 */
	public float				rate;
	/** 下载数 */
	public long					userNum;
	/** 应用大小 */
	public String				apkFileSize;
	/** 应用更新时间 */
	public String				updateTime;
	/** 版本更新说明 */
	public String				updateVersionDes;
	/** APK下载地址 */
	public String				url;
	/** 下载文件名称 */
	public String				fileName;

	public ContentValues UpdateAppInfo2ContentValues() {
		ContentValues contentValues = new ContentValues();
		contentValues.put(UpdateAppInfo.KEY_STATUS, status);
		contentValues.put(UpdateAppInfo.KEY_FILE_PATH, filePath);
		contentValues.put(UpdateAppInfo.KEY_TIMESTAMP, timeStamp);
		contentValues.put(UpdateAppInfo.KEY_PKGNAME, pkgName);
		contentValues.put(UpdateAppInfo.KEY_NEEDUPDATE, isUpdate);
		contentValues.put(UpdateAppInfo.KEY_VERSION, version);
		contentValues.put(UpdateAppInfo.KEY_APPNAME, appName);
		contentValues.put(UpdateAppInfo.Key_APP_ID, appId);
		contentValues.put(UpdateAppInfo.KEY_ICONURL, iconUrl);
		contentValues.put(UpdateAppInfo.KEY_RATE, rate);
		contentValues.put(UpdateAppInfo.KEY_USERNUM, userNum);
		contentValues.put(UpdateAppInfo.KEY_APKFILESIZE, apkFileSize);
		contentValues.put(UpdateAppInfo.KEY_UPDATETIME, updateTime);
		contentValues.put(UpdateAppInfo.KEY_UPDATEVERSIONDES, updateVersionDes);
		contentValues.put(UpdateAppInfo.KEY_URL, url);
		contentValues.put(UpdateAppInfo.KEY_FILENAME, fileName);

		return contentValues;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("status           = ").append(status).append("\n");
		sb.append("filePath         = ").append(filePath).append("\n");
		sb.append("timeStamp        = ").append(timeStamp).append("\n");
		sb.append("pkgName          = ").append(pkgName).append("\n");
		sb.append("update           = ").append(isUpdate).append("\n");
		sb.append("version          = ").append(version).append("\n");
		sb.append("appName          = ").append(appName).append("\n");
		sb.append("appId            = ").append(appId).append("\n");
		sb.append("iconUrl          = ").append(iconUrl).append("\n");
		sb.append("rate             = ").append(rate).append("\n");
		sb.append("userNum          = ").append(userNum).append("\n");
		sb.append("apkFileSize      = ").append(apkFileSize).append("\n");
		sb.append("updateTime       = ").append(updateTime).append("\n");
		sb.append("updateVersionDes = ").append(updateVersionDes).append("\n");
		sb.append("url              = ").append(url).append("\n");
		sb.append("fileName         = ").append(fileName).append("\n");
		return sb.toString();
	}

}
